        <%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.Connection" %><%--
  Created by IntelliJ IDEA.
  User: 32104
  Date: 2024/6/16
  Time: 上午7:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改</title>
</head>
<body>
<%
    Integer id = Integer.parseInt(request.getParameter("id"));
    String name = "";
    int age = 0;
    String address = null;
    String phone = null;
    Integer sex = null;
    try {
        Class.forName("com.mysql.cj.jdbc.Driver");
        String url = "jdbc:mysql://localhost:3306/student?serverTimezone=Asia/Shanghai";
        String userName = "root";
        String userPassword = "root";
        Connection connection1 = DriverManager.getConnection(url, userName, userPassword);
        Statement statement1 = connection1.createStatement();
        String selectSQL = "select * from user_info where id=" + id;
        ResultSet resultSet1 = statement1.executeQuery(selectSQL);
        while (resultSet1.next()) {
            name = resultSet1.getString("name");
            age = resultSet1.getInt("age");
            address = resultSet1.getString("address");
            phone = resultSet1.getString("phone");
            sex = resultSet1.getInt("sex");
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

%>
<form action="../Subject/upDate.jsp" method="post">
    <label>
        姓名:<input type="text" value="<%=name%>" name="name"/>
    </label>
    <label>
        年龄:<input type="text" value="<%=age%>" name="age"/>
    </label>
    <label>
        住址:<input type="text" value="<%=address%>" name="address"/>
    </label>
    <label>
        电话:<input type="text" value="<%=phone%>" name="phone"/>
    </label>
    <label>
        性别:<input type="radio" value="1" name="sex" <%=sex==1?"checked":""%>/>男
        <input type="radio" name="sex" value="0" <%=sex!=1?"checked":""%>/>女
    </label>
    <input type="submit" value="保存"/><button><a href="../Subject/index1.jsp" style="text-decoration: none;color: aqua">返回</a></button>
</form>
</body>
</html>
